import request from '@/utils/request'

// 查询库存记录列表
export function listInventoryRecord(query) {
  return request({
    url: '/inventory/record/list',
    method: 'get',
    params: query
  })
}

// 查询库存记录详细
export function getInventoryRecord(recordId) {
  return request({
    url: '/inventory/record/' + recordId,
    method: 'get'
  })
}

// 新增库存记录
export function addInventoryRecord(data) {
  return request({
    url: '/inventory/record',
    method: 'post',
    data: data
  })
}

// 修改库存记录
export function updateInventoryRecord(data) {
  return request({
    url: '/inventory/record',
    method: 'put',
    data: data
  })
}

// 删除库存记录
export function delInventoryRecord(recordId) {
  return request({
    url: '/inventory/record/' + recordId,
    method: 'delete'
  })
}

// 导出库存记录
export function exportInventoryRecord(query) {
  return request({
    url: '/inventory/record/export',
    method: 'post',
    params: query
  })
}

// 校验记录编号
export function checkRecordCodeUnique(data) {
  return request({
    url: '/inventory/record/checkRecordCodeUnique',
    method: 'post',
    data: data
  })
}

// 根据物料编码查询库存记录
export function listByMaterialCode(materialCode) {
  return request({
    url: '/inventory/record/listByMaterialCode/' + materialCode,
    method: 'get'
  })
}

// 根据仓库编码查询库存记录
export function listByWarehouseCode(warehouseCode) {
  return request({
    url: '/inventory/record/listByWarehouseCode/' + warehouseCode,
    method: 'get'
  })
}

// 根据关联单号查询库存记录
export function listByRelatedCode(relatedCode) {
  return request({
    url: '/inventory/record/listByRelatedCode/' + relatedCode,
    method: 'get'
  })
}